package cn.yeziji.forum.dto.user;

import cn.yeziji.forum.utils.StrUtils;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
 * @author gzkemays
 * @since 2022/4/15 17:58
 */
@Data
public class EmailDTO {
  @NotBlank(message = "发送地址不能为空")
  String to;

  String subject;
  String additional;
  String code;

  @NotBlank(message = "时间戳不能为空")
  String timestamp;

  public void buildEmailCodeDto() {
    this.subject = "欢迎注册椰子鸡论坛";
    this.additional = "欢迎加入椰子鸡大家庭，请在 1 分钟内输入验证码否则会失效哦~";
  }

  public String doEmail() {
    this.to = StrUtils.deStr(to, timestamp);
    return to;
  }
}
